#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
void reSort(int a[], int num) {
	int left = 0;
	int right = num - 1;
	while (left < right) {
		while (left < right && (a[left] & 1)) {
			left++;
		}
		while (left < right && !(a[right] & 1)) {
			right--;
		}
		if (left < right) {
			int tmp = a[left];
			a[left] = a[right];
			a[right] = tmp;
		}
	}
}
void show(int a[], int num) {
	for (int i = 0; i < num; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}
int main() {
	int a[] = { 1,2,3,4,5,6 };
	int num = sizeof(a) / sizeof(a[0]);
	reSort(a, num);
	show(a, num);
	return 0;
}